//
// Controlls the main layout
//

/* A standard controller copied from bootstrap */
.container {
  width: 100%;
  padding-right: 15px;
  padding-left: 15px;
  margin-right: auto;
  margin-left: auto;
}
@media (min-width: 576px) {
  .container {
    max-width: 540px;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 720px;
  }
}
@media (min-width: 992px) {
  .container {
    max-width: 960px;
  }
}
@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
}

/* A padding wrapper class */
.wrapper {
  padding: $padding-normal;
}
.wrapper-v {
  padding: 0 $padding-normal;
}
.wrapper-h {
  padding: $padding-normal 0;
}
.wrapper-big {
  padding: $padding-big;
}
.wrapper-big-v {
  padding: 0 $padding-big;
}
.wrapper-big-h {
  padding: $padding-big 0;
}

/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/* Blog header, contains logo, nav */
/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
#blog-header {
  @extend .wrapper-h;
  .container {
    display: flex;
  }

  // Entire navbar
  .blog-navbar {
    display: flex;
    position: relative;
  }

  // Logo
  .blog-logo {
    display: inline-block;
    margin-right: $padding-normal;

    & > * {
      vertical-align: middle;
    }
    .blog-logo-text {
      font-size: 1.2rem;
      margin-left: $padding-small;
    }
  }

  // Nav collapse toggle button
  .blog-navbar-toggler {
    display: none;
    svg {
      vertical-align: middle;
      height: 30px;
    }
  }

  // Navs
  .blog-navbar-nav {
    display: flex;
    ul {
      display: flex;
      flex-direction: row;

      li a {
        padding: 9px 20px;
        display: inline-block;
        color: #636b6f;
      }
      li.active a, li:hover a {
        color: $fg;
      }
    }
  }
}

/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/* Blog mainarea, contains main(left) and side(right) part */
/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
#blog-mainarea {
  padding: $padding-normal 0;
  & > .container {
    display: flex;
    & > * {
      margin-left: 15px;
    }
    & > *:first-child {
      margin-left: 0;
    }
  }

  // Home page banner
  .blog-main-banner {
    // background-color: $bg;
    // color: $fg-reserve;
    // text-align: center;
    transition: height 0.6s cubic-bezier(0.2, 0.5, 0.1, 1);
    overflow: hidden;
    height: 160px;
    // display: none;
    // border-bottom: 1px solid mix(#888888, $bg-back, 10);

    & > .container {
      padding: $padding-big;
      position: relative;
    }
    h1 {
      line-height: 4rem;
      font-size: 2rem;
    }
    p {
      line-height: 1.8rem;
      font-size: 1rem;
    }
    button.hide {
      border: none;
      background: none;
      position: absolute;
      color: mix($fg, $bg-back, 50);
      right: $padding-big;
      bottom: $padding-big;
    }
  }
  @media (min-width: $breakpoint-sm) {
    .blog-main-banner {
      height: 200px;
      h1 { line-height: 6rem; font-size: 3rem; }
      p { line-height: 2.2rem; font-size: 1.1rem; }
    }
  }
  @media (min-width: $breakpoint-md) {
    .blog-main-banner {
      height: 250px;
      h1 { line-height: 8rem; font-size: 4rem; }
      p { line-height: 2.4rem; font-size: 1.2rem; }
    }
  }
  // Main area
  .blog-main {
    flex: 1;
    overflow: scroll;
    // Article list area, main area
    .blog-article-list {
      // padding: $padding-big;
      .article {
        margin-bottom: $padding-big;
        .title {
          font-size: 1.8rem;
          a {
            color: $fg;
            &:hover {
              text-decoration: none;
              @include hover-shadow;
            }
          }
        }
        .introduction {
          color: $color-gray;
          line-height: 3rem;
        }
        .short-content {
          line-height: 1.8rem;
        }
        .tag {
          display: inline-block;
          margin-right: $padding-small;
          color: $color-gray;
          &:hover {
            color: $fg;
          }
        }
      }
    }
  }
  // Side area
  .blog-side {
    width: 30%;
    min-width: 200px;
    max-width: 290px;
    h1 {
      margin-bottom: 0.5rem;
    }

    .side-container {
      /* Side may have multiple content blocks */
      .side-element {
        // background: $bg;
        margin-bottom: 1rem;
        & > .title {
          font-size: 1.4rem;
          margin-bottom: 1rem;
        }
      }
    }
    .side-element .article-list li {
      margin-bottom: 0.5rem;
    }
    .side-element .article-list li > * {
      display: block;
    }
    .side-element .article-list li > a.title {
      color: #007bff;
      &:hover { color: #0056b3; text-decoration: underline; }
    }
    .side-element .article-list li > .date {
      font-size: 90%;
    }
    .side-element .article-list li > .title {
      font-size: inherit;
    }
  }
}

.blog-article-container .article {

  .title, .introduction {
    text-align: center;
  }
  .title {
    font-size: 2rem;
    line-height: 4rem;
    word-break: keep-all;
    text-overflow: ellipsis;
    overflow: hidden;
  }
  .introduction {
    margin-bottom: $padding-big;
  }
}

/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/* Blog footer */
/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
#blog-footer {
  // background-color: $color-dark;
  // text-align: center;
  padding: 24px 0 36px 0;
  // color: $fg-reserve;
  p {
    margin-top: 0;
    margin-bottom: 1rem;
  }
  a {
    color: #007bff;
    text-decoration: none;
    background-color: transparent;
    &:hover {
      color: #0056b3;
      text-decoration: underline;
    }
  }
}

/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/* Post page */
/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */

#markdown-toc {
  padding-left: 4px;
}
#markdown-toc > li {
  /*display: none;*/
  margin-bottom: 8px;
}
#markdown-toc > li li > a {
  padding: 3px 0px 3px 12px;
  font-size: 90%;
}
#markdown-toc > li li li > a {
  padding: 3px 0px 3px 20px;
  font-size: 80%;
}

.post-header {
  .meta {
    margin-top: 0.5rem;
    color: $color-gray;
  }
}
.post-content {
  line-height: 1.8rem;
}
.post-footer {
  margin-top: 3rem;
}
